#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#define High 18
#define Width 30

int main(){
	int pos_x = Width / 2;
	int pos_y = 1;
	int v_y = 1;
	int v_x = 1;
	int i, j;
	while(1){
		system("cls");
		for (i = 1; i <= High; i ++){
			for (j = 1; j <= Width; j ++){
				if (i == pos_y && j == pos_x){
					printf ("o");
				}
				else if (i == High){
					printf ("_");
				}
				else if (j == Width){
					printf ("|");
				}
				else
					printf (" ");
				
			}
			printf("\n");
			
		}
		pos_y = pos_y + v_y;
		pos_x = pos_x + v_x;
		if (pos_y == High || pos_y == 1){
			v_y = -v_y;
			printf("\a");
		}
		if (pos_x == Width || pos_x == 1){
			v_x = -v_x;
			printf("\a");
		}
		Sleep(2);
		
	}
	
	
	
	
	return 0;
}